home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / bzone.c < prev    next >
C/C++ Source or Header  |  2000-05-13  |  22KB  |  675 lines

  1. /***************************************************************************
  2.  
  3. Battlezone memory map (preliminary)
  4.  
  5. 0000-04ff RAM
  6. 0800      IN0
  7. 0a00      IN1
  8. 0c00      IN2
  9.  
  10. 1200      Vector generator start (write)
  11. 1400
  12. 1600      Vector generator reset (write)
  13.  
  14. 1800      Mathbox Status register
  15. 1810      Mathbox value (lo-byte)
  16. 1818      Mathbox value (hi-byte)
  17. 1820-182f POKEY I/O
  18. 1828      Control inputs
  19. 1860-187f Mathbox RAM
  20.  
  21. 2000-2fff Vector generator RAM
  22. 3000-37ff Mathbox ROM
  23. 5000-7fff ROM
  24.  
  25. Battlezone settings:
  26.  
  27. 0 = OFF  1 = ON  X = Don't Care  $ = Atari suggests
  28.  
  29. ** IMPORTANT - BITS are INVERTED in the game itself **
  30.  
  31. TOP 8 SWITCH DIP
  32. 87654321
  33. --------
  34. XXXXXX11   Free Play
  35. XXXXXX10   1 coin for 2 plays
  36. XXXXXX01   1 coin for 1 play
  37. XXXXXX00   2 coins for 1 play
  38. XXXX11XX   Right coin mech x 1
  39. XXXX10XX   Right coin mech x 4
  40. XXXX01XX   Right coin mech x 5
  41. XXXX00XX   Right coin mech x 6
  42. XXX1XXXX   Center (or Left) coin mech x 1
  43. XXX0XXXX   Center (or Left) coin mech x 2
  44. 111XXXXX   No bonus coin
  45. 110XXXXX   For every 2 coins inserted, game logic adds 1 more
  46. 101XXXXX   For every 4 coins inserted, game logic adds 1 more
  47. 100XXXXX   For every 4 coins inserted, game logic adds 2 more
  48. 011XXXXX   For every 5 coins inserted, game logic adds 1 more
  49.  
  50. BOTTOM 8 SWITCH DIP
  51. 87654321
  52. --------
  53. XXXXXX11   Game starts with 2 tanks
  54. XXXXXX10   Game starts with 3 tanks  $
  55. XXXXXX01   Game starts with 4 tanks
  56. XXXXXX00   Game starts with 5 tanks
  57. XXXX11XX   Missile appears after 5,000 points
  58. XXXX10XX   Missile appears after 10,000 points  $
  59. XXXX01XX   Missile appears after 20,000 points
  60. XXXX00XX   Missile appears after 30,000 points
  61. XX11XXXX   No bonus tank
  62. XX10XXXX   Bonus taks at 15,000 and 100,000 points  $
  63. XX01XXXX   Bonus taks at 20,000 and 100,000 points
  64. XX00XXXX   Bonus taks at 50,000 and 100,000 points
  65. 11XXXXXX   English language
  66. 10XXXXXX   French language
  67. 01XXXXXX   German language
  68. 00XXXXXX   Spanish language
  69.  
  70. 4 SWITCH DIP
  71.  
  72. XX11   All coin mechanisms register on one coin counter
  73. XX01   Left and center coin mechanisms on one coin counter, right on second
  74. XX10   Center and right coin mechanisms on one coin counter, left on second
  75. XX00   Each coin mechanism has it's own counter
  76.  
  77.  
  78. ++++++++++++++++++++++++++
  79.  
  80.  
  81.  
  82. Red Baron memory map (preliminary)
  83.  
  84. 0000-04ff RAM
  85. 0800      COIN_IN
  86. 0a00      IN1
  87. 0c00      IN2
  88.  
  89. 1200      Vector generator start (write)
  90. 1400
  91. 1600      Vector generator reset (write)
  92.  
  93. 1800      Mathbox Status register
  94. 1802      Button inputs
  95. 1804      Mathbox value (lo-byte)
  96. 1806      Mathbox value (hi-byte)
  97. 1808      Red Baron Sound (bit 1 selects joystick pot to read also)
  98. 1810-181f POKEY I/O
  99. 1818      Joystick inputs
  100. 1860-187f Mathbox RAM
  101.  
  102. 2000-2fff Vector generator RAM
  103. 3000-37ff Mathbox ROM
  104. 5000-7fff ROM
  105.  
  106. RED BARON DIP SWITCH SETTINGS
  107. Donated by Dana Colbert
  108.  
  109.  
  110. $=Default
  111. "K" = 1,000
  112.  
  113. Switch at position P10
  114.                                   8    7    6    5    4    3    2    1
  115.                                 _________________________________________
  116. English                        $|    |    |    |    |    |    |Off |Off |
  117. Spanish                         |    |    |    |    |    |    |Off | On |
  118. French                          |    |    |    |    |    |    | On |Off |
  119. German                          |    |    |    |    |    |    | On | On |
  120.                                 |    |    |    |    |    |    |    |    |
  121.  Bonus airplane granted at:     |    |    |    |    |    |    |    |    |
  122. Bonus at 2K, 10K and 30K        |    |    |    |    |Off |Off |    |    |
  123. Bonus at 4K, 15K and 40K       $|    |    |    |    |Off | On |    |    |
  124. Bonus at 6K, 20K and 50K        |    |    |    |    | On |Off |    |    |
  125. No bonus airplanes              |    |    |    |    | On | On |    |    |
  126.                                 |    |    |    |    |    |    |    |    |
  127. 2 aiplanes per game             |    |    |Off |Off |    |    |    |    |
  128. 3 airplanes per game           $|    |    |Off | On |    |    |    |    |
  129. 4 airplanes per game            |    |    | On |Off |    |    |    |    |
  130. 5 airplanes per game            |    |    | On | On |    |    |    |    |
  131.                                 |    |    |    |    |    |    |    |    |
  132. 1-play minimum                 $|    |Off |    |    |    |    |    |    |
  133. 2-play minimum                  |    | On |    |    |    |    |    |    |
  134.                                 |    |    |    |    |    |    |    |    |
  135. Self-adj. game difficulty: on  $|Off |    |    |    |    |    |    |    |
  136. Self-adj. game difficulty: off  | On |    |    |    |    |    |    |    |
  137.                                 -----------------------------------------
  138.  
  139.   If self-adjusting game difficulty feature is
  140. turned on, the program strives to maintain the
  141. following average game lengths (in seconds):
  142.  
  143.                                         Airplanes per game:
  144.      Bonus airplane granted at:          2   3     4     5
  145. 2,000, 10,000 and 30,000 points         90  105$  120   135
  146. 4,000, 15,000 and 40,000 points         75   90   105   120
  147. 6,000, 20,000 and 50,000 points         60   75    90   105
  148.              No bonus airplanes         45   60    75    90
  149.  
  150.  
  151.  
  152. Switch at position M10
  153.                                   8    7    6    5    4    3    2    1
  154.                                 _________________________________________
  155.     50  PER PLAY                |    |    |    |    |    |    |    |    |
  156.  Straight 25  Door:             |    |    |    |    |    |    |    |    |
  157. No Bonus Coins                  |Off |Off |Off |Off |Off |Off | On | On |
  158. Bonus $1= 3 plays               |Off | On | On |Off |Off |Off | On | On |
  159. Bonus $1= 3 plays, 75 = 2 plays |Off |Off | On |Off |Off |Off | On | On |
  160.                                 |    |    |    |    |    |    |    |    |
  161.  25 /$1 Door or 25 /25 /$1 Door |    |    |    |    |    |    |    |    |
  162. No Bonus Coins                  |Off |Off |Off |Off |Off | On | On | On |
  163. Bonus $1= 3 plays               |Off | On | On |Off |Off | On | On | On |
  164. Bonus $1= 3 plays, 75 = 2 plays |Off |Off | On |Off |Off | On | On | On |
  165.                                 |    |    |    |    |    |    |    |    |
  166.     25  PER PLAY                |    |    |    |    |    |    |    |    |
  167.  Straight 25  Door:             |    |    |    |    |    |    |    |    |
  168. No Bonus Coins                  |Off |Off |Off |Off |Off |Off | On |Off |
  169. Bonus 50 = 3 plays              |Off |Off | On |Off |Off |Off | On |Off |
  170. Bonus $1= 5 plays               |Off | On |Off |Off |Off |Off | On |Off |
  171.                                 |    |    |    |    |    |    |    |    |
  172.  25 /$1 Door or 25 /25 /$1 Door |    |    |    |    |    |    |    |    |
  173. No Bonus Coins                  |Off |Off |Off |Off |Off | On | On |Off |
  174. Bonus 50 = 3 plays              |Off |Off | On |Off |Off | On | On |Off |
  175. Bonus $1= 5 plays               |Off | On |Off |Off |Off | On | On |Off |
  176.                                 -----------------------------------------
  177.  
  178. Switch at position L11
  179.                                                       1    2    3    4
  180.                                                     _____________________
  181. All 3 mechs same denomination                       | On | On |    |    |
  182. Left and Center same, right different denomination  | On |Off |    |    |
  183. Right and Center same, left differnnt denomination  |Off | On |    |    |
  184. All different denominations                         |Off |Off |    |    |
  185.                                                     ---------------------
  186.  
  187. ***************************************************************************/
  188.  
  189. #include "driver.h"
  190. #include "vidhrdw/generic.h"
  191. #include "vidhrdw/vector.h"
  192. #include "vidhrdw/avgdvg.h"
  193. #include "machine/mathbox.h"
  194. #include "machine/atari_vg.h"
  195.  
  196. #define IN0_3KHZ (1<<7)
  197. #define IN0_VG_HALT (1<<6)
  198.  
  199. WRITE_HANDLER( redbaron_sounds_w );
  200. WRITE_HANDLER( bzone_sounds_w );
  201. int bzone_sh_start(const struct MachineSound *msound);
  202. void bzone_sh_stop(void);
  203. void bzone_sh_update(void);
  204. int redbaron_sh_start(const struct MachineSound *msound);
  205. void redbaron_sh_stop(void);
  206. void redbaron_sh_update(void);
  207.  
  208. READ_HANDLER( bzone_IN0_r )
  209. {
  210.     int res;
  211.  
  212.     res = readinputport(0);
  213.  
  214.     if (cpu_gettotalcycles() & 0x100)
  215.         res |= IN0_3KHZ;
  216.     else
  217.         res &= ~IN0_3KHZ;
  218.  
  219.     if (avgdvg_done())
  220.         res |= IN0_VG_HALT;
  221.     else
  222.         res &= ~IN0_VG_HALT;
  223.  
  224.     return res;
  225. }
  226.  
  227. /* Translation table for one-joystick emulation */
  228. static int one_joy_trans[32]={
  229.         0x00,0x0A,0x05,0x00,0x06,0x02,0x01,0x00,
  230.         0x09,0x08,0x04,0x00,0x00,0x00,0x00,0x00 };
  231.  
  232. static READ_HANDLER( bzone_IN3_r )
  233. {
  234.     int res,res1;
  235.  
  236.     res=readinputport(3);
  237.     res1=readinputport(4);
  238.  
  239.     res|=one_joy_trans[res1&0x1f];
  240.  
  241.     return (res);
  242. }
  243.  
  244. static int bzone_interrupt(void)
  245. {
  246.     if (readinputport(0) & 0x10)
  247.         return nmi_interrupt();
  248.     else
  249.         return ignore_interrupt();
  250. }
  251.  
  252. int rb_input_select;
  253.  
  254. static READ_HANDLER( redbaron_joy_r )
  255. {
  256.     if (rb_input_select)
  257.         return readinputport (5);
  258.     else
  259.         return readinputport (6);
  260. }
  261.  
  262.  
  263. static struct MemoryReadAddress bzone_readmem[] =
  264. {
  265.     { 0x0000, 0x03ff, MRA_RAM },
  266.     { 0x0800, 0x0800, bzone_IN0_r },    /* IN0 */
  267.     { 0x0a00, 0x0a00, input_port_1_r },    /* DSW1 */
  268.     { 0x0c00, 0x0c00, input_port_2_r },    /* DSW2 */
  269.     { 0x1800, 0x1800, mb_status_r },
  270.     { 0x1810, 0x1810, mb_lo_r },
  271.     { 0x1818, 0x1818, mb_hi_r },
  272.     { 0x1820, 0x182f, pokey1_r },
  273.     { 0x2000, 0x2fff, MRA_RAM },
  274.     { 0x3000, 0x3fff, MRA_ROM },
  275.     { 0x5000, 0x7fff, MRA_ROM },
  276.     { 0xf800, 0xffff, MRA_ROM },        /* for the reset / interrupt vectors */
  277.     { -1 }    /* end of table */
  278. };
  279.  
  280. static struct MemoryWriteAddress bzone_writemem[] =
  281. {
  282.     { 0x0000, 0x03ff, MWA_RAM },
  283.     { 0x1000, 0x1000, coin_counter_w },
  284.     { 0x1200, 0x1200, avgdvg_go_w },
  285.     { 0x1400, 0x1400, watchdog_reset_w },
  286.     { 0x1600, 0x1600, avgdvg_reset_w },
  287.     { 0x1820, 0x182f, pokey1_w },
  288.     { 0x1840, 0x1840, bzone_sounds_w },
  289.     { 0x1860, 0x187f, mb_go_w },
  290.     { 0x2000, 0x2fff, MWA_RAM, &vectorram, &vectorram_size },
  291.     { 0x3000, 0x3fff, MWA_ROM },
  292.     { 0x5000, 0x7fff, MWA_ROM },
  293.     { -1 }    /* end of table */
  294. };
  295.  
  296.  
  297. INPUT_PORTS_START( bzone )
  298.     PORT_START    /* IN0 */
  299.     PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_COIN1)
  300.     PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_COIN2)
  301.     PORT_BIT ( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED)
  302.     PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
  303.     PORT_BITX( 0x20, IP_ACTIVE_LOW, IPT_SERVICE, "Diagnostic Step", KEYCODE_F1, IP_JOY_NONE )
  304.     /* bit 6 is the VG HALT bit. We set it to "low" */
  305.     /* per default (busy vector processor). */
  306.      /* handled by bzone_IN0_r() */
  307.     PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  308.     /* bit 7 is tied to a 3khz clock */
  309.      /* handled by bzone_IN0_r() */
  310.     PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  311.  
  312.     PORT_START    /* DSW0 */
  313.     PORT_DIPNAME(0x03, 0x01, DEF_STR( Lives ) )
  314.     PORT_DIPSETTING (  0x00, "2" )
  315.     PORT_DIPSETTING (  0x01, "3" )
  316.     PORT_DIPSETTING (  0x02, "4" )
  317.     PORT_DIPSETTING (  0x03, "5" )
  318.     PORT_DIPNAME(0x0c, 0x04, "Missile appears at" )
  319.     PORT_DIPSETTING (  0x00, "5000" )
  320.     PORT_DIPSETTING (  0x04, "10000" )
  321.     PORT_DIPSETTING (  0x08, "20000" )
  322.     PORT_DIPSETTING (  0x0c, "30000" )
  323.     PORT_DIPNAME(0x30, 0x10, DEF_STR( Bonus_Life ) )
  324.     PORT_DIPSETTING (  0x10, "15k and 100k" )
  325.     PORT_DIPSETTING (  0x20, "20k and 100k" )
  326.     PORT_DIPSETTING (  0x30, "50k and 100k" )
  327.     PORT_DIPSETTING (  0x00, "None" )
  328.     PORT_DIPNAME(0xc0, 0x00, "Language" )
  329.     PORT_DIPSETTING (  0x00, "English" )
  330.     PORT_DIPSETTING (  0x40, "German" )
  331.     PORT_DIPSETTING (  0x80, "French" )
  332.     PORT_DIPSETTING (  0xc0, "Spanish" )
  333.  
  334.     PORT_START    /* DSW1 */
  335.     PORT_DIPNAME(0x03, 0x02, DEF_STR( Coinage ) )
  336.     PORT_DIPSETTING (  0x03, DEF_STR( 2C_1C ) )
  337.     PORT_DIPSETTING (  0x02, DEF_STR( 1C_1C ) )
  338.     PORT_DIPSETTING (  0x01, DEF_STR( 1C_2C ) )
  339.     PORT_DIPSETTING (  0x00, DEF_STR( Free_Play ) )
  340.     PORT_DIPNAME(0x0c, 0x00, DEF_STR( Coin_B ) )
  341.     PORT_DIPSETTING (  0x00, "*1" )
  342.     PORT_DIPSETTING (  0x04, "*4" )
  343.     PORT_DIPSETTING (  0x08, "*5" )
  344.     PORT_DIPSETTING (  0x0c, "*6" )
  345.     PORT_DIPNAME(0x10, 0x00, DEF_STR( Coin_A ) )
  346.     PORT_DIPSETTING (  0x00, "*1" )
  347.     PORT_DIPSETTING (  0x10, "*2" )
  348.     PORT_DIPNAME(0xe0, 0x00, "Bonus Coins" )
  349.     PORT_DIPSETTING (  0x00, "None" )
  350.     PORT_DIPSETTING (  0x20, "3 credits/2 coins" )
  351.     PORT_DIPSETTING (  0x40, "5 credits/4 coins" )
  352.     PORT_DIPSETTING (  0x60, "6 credits/4 coins" )
  353.     PORT_DIPSETTING (  0x80, "6 credits/5 coins" )
  354.  
  355.     PORT_START    /* IN3 */
  356.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN | IPF_2WAY )
  357.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP   | IPF_2WAY )
  358.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN  | IPF_2WAY )
  359.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP    | IPF_2WAY )
  360.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON3 )
  361.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START1 )
  362.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START2 )
  363.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
  364.  
  365.     PORT_START    /* fake port for single joystick control */
  366.     /* This fake port is handled via bzone_IN3_r */
  367.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_CHEAT )
  368.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_CHEAT )
  369.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_CHEAT )
  370.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_CHEAT )
  371.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_CHEAT )
  372. INPUT_PORTS_END
  373.  
  374.  
  375. static struct MemoryReadAddress redbaron_readmem[] =
  376. {
  377.     { 0x0000, 0x03ff, MRA_RAM },
  378.     { 0x0800, 0x0800, bzone_IN0_r },    /* IN0 */
  379.     { 0x0a00, 0x0a00, input_port_1_r },    /* DSW1 */
  380.     { 0x0c00, 0x0c00, input_port_2_r },    /* DSW2 */
  381.     { 0x1800, 0x1800, mb_status_r },
  382.     { 0x1802, 0x1802, input_port_4_r },    /* IN4 */
  383.     { 0x1804, 0x1804, mb_lo_r },
  384.     { 0x1806, 0x1806, mb_hi_r },
  385.     { 0x1810, 0x181f, pokey1_r },
  386.     { 0x1820, 0x185f, atari_vg_earom_r },
  387.     { 0x2000, 0x2fff, MRA_RAM },
  388.     { 0x3000, 0x3fff, MRA_ROM },
  389.     { 0x5000, 0x7fff, MRA_ROM },
  390.     { 0xf800, 0xffff, MRA_ROM },        /* for the reset / interrupt vectors */
  391.     { -1 }    /* end of table */
  392. };
  393.  
  394. static struct MemoryWriteAddress redbaron_writemem[] =
  395. {
  396.     { 0x0000, 0x03ff, MWA_RAM },
  397.     { 0x1000, 0x1000, MWA_NOP },            /* coin out */
  398.     { 0x1200, 0x1200, avgdvg_go_w },
  399.     { 0x1400, 0x1400, MWA_NOP },            /* watchdog clear */
  400.     { 0x1600, 0x1600, avgdvg_reset_w },
  401.     { 0x1808, 0x1808, redbaron_sounds_w },    /* and select joystick pot also */
  402.     { 0x180a, 0x180a, MWA_NOP },            /* sound reset, yet todo */
  403.     { 0x180c, 0x180c, atari_vg_earom_ctrl_w },
  404.     { 0x1810, 0x181f, pokey1_w },
  405.     { 0x1820, 0x185f, atari_vg_earom_w },
  406.     { 0x1860, 0x187f, mb_go_w },
  407.     { 0x2000, 0x2fff, MWA_RAM, &vectorram, &vectorram_size },
  408.     { 0x3000, 0x3fff, MWA_ROM },
  409.     { 0x5000, 0x7fff, MWA_ROM },
  410.     { -1 }    /* end of table */
  411. };
  412.  
  413.  
  414. INPUT_PORTS_START( redbaron )
  415.     PORT_START    /* IN0 */
  416.     PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_COIN1)
  417.     PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_COIN2)
  418.     PORT_BIT ( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED)
  419.     PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
  420.     PORT_BITX( 0x20, IP_ACTIVE_LOW, IPT_SERVICE, "Diagnostic Step", KEYCODE_F1, IP_JOY_NONE )
  421.     /* bit 6 is the VG HALT bit. We set it to "low" */
  422.     /* per default (busy vector processor). */
  423.      /* handled by bzone_IN0_r() */
  424.     PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  425.     /* bit 7 is tied to a 3khz clock */
  426.      /* handled by bzone_IN0_r() */
  427.     PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  428.  
  429.     PORT_START    /* DSW0 */
  430.     /* See the table above if you are really interested */
  431.     PORT_DIPNAME(0xff, 0xfd, DEF_STR( Coinage ) )
  432.     PORT_DIPSETTING (  0xfd, "Normal" )
  433.  
  434.     PORT_START    /* DSW1 */
  435.     PORT_DIPNAME(0x03, 0x03, "Language" )
  436.     PORT_DIPSETTING (  0x00, "German" )
  437.     PORT_DIPSETTING (  0x01, "French" )
  438.     PORT_DIPSETTING (  0x02, "Spanish" )
  439.     PORT_DIPSETTING (  0x03, "English" )
  440.     PORT_DIPNAME(0x0c, 0x04, DEF_STR( Bonus_Life ) )
  441.     PORT_DIPSETTING (  0x0c, "2k 10k 30k" )
  442.     PORT_DIPSETTING (  0x08, "4k 15k 40k" )
  443.     PORT_DIPSETTING (  0x04, "6k 20k 50k" )
  444.     PORT_DIPSETTING (  0x00, "None" )
  445.     PORT_DIPNAME(0x30, 0x20, DEF_STR( Lives ) )
  446.     PORT_DIPSETTING (  0x30, "2" )
  447.     PORT_DIPSETTING (  0x20, "3" )
  448.     PORT_DIPSETTING (  0x10, "4" )
  449.     PORT_DIPSETTING (  0x00, "5" )
  450.     PORT_DIPNAME(0x40, 0x40, "One Play Minimum" )
  451.     PORT_DIPSETTING (  0x40, DEF_STR( Off ) )
  452.     PORT_DIPSETTING (  0x00, DEF_STR( On ) )
  453.     PORT_DIPNAME(0x80, 0x80, "Self Adjust Diff" )
  454.     PORT_DIPSETTING (  0x80, DEF_STR( Off ) )
  455.     PORT_DIPSETTING (  0x00, DEF_STR( On ) )
  456.  
  457.     /* IN3 - the real machine reads either the X or Y axis from this port */
  458.     /* Instead, we use the two fake 5 & 6 ports and bank-switch the proper */
  459.     /* value based on the lsb of the byte written to the sound port */
  460.     PORT_START
  461.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_4WAY )
  462.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  463.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_4WAY )
  464.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_4WAY )
  465.  
  466.     PORT_START    /* IN4 - misc controls */
  467.     PORT_BIT( 0x3f, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  468.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START1 )
  469.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  470.  
  471.     /* These 2 are fake - they are bank-switched from reads to IN3 */
  472.     /* Red Baron doesn't seem to use the full 0-255 range. */
  473.     PORT_START    /* IN5 */
  474.     PORT_ANALOG( 0xff, 0x80, IPT_AD_STICK_X, 25, 10, 64, 192 )
  475.  
  476.     PORT_START    /* IN6 */
  477.     PORT_ANALOG( 0xff, 0x80, IPT_AD_STICK_Y, 25, 10, 64, 192 )
  478. INPUT_PORTS_END
  479.  
  480.  
  481.  
  482. static struct POKEYinterface bzone_pokey_interface =
  483. {
  484.     1,    /* 1 chip */
  485.     1500000,    /* 1.5 MHz??? */
  486.     { 100 },
  487.     /* The 8 pot handlers */
  488.     { 0 },
  489.     { 0 },
  490.     { 0 },
  491.     { 0 },
  492.     { 0 },
  493.     { 0 },
  494.     { 0 },
  495.     { 0 },
  496.     /* The allpot handler */
  497.     { bzone_IN3_r },
  498. };
  499.  
  500. static struct CustomSound_interface bzone_custom_interface =
  501. {
  502.     bzone_sh_start,
  503.     bzone_sh_stop,
  504.     bzone_sh_update
  505. };
  506.  
  507.  
  508. static struct MachineDriver machine_driver_bzone =
  509. {
  510.     /* basic machine hardware */
  511.     {
  512.         {
  513.             CPU_M6502,
  514.             1500000,    /* 1.5 Mhz */
  515.             bzone_readmem,bzone_writemem,0,0,
  516.             bzone_interrupt,6 /* 4.1ms */
  517.         }
  518.     },
  519.     40, 0,    /* frames per second, vblank duration (vector game, so no vblank) */
  520.     1,
  521.     0,
  522.  
  523.     /* video hardware */
  524.     400, 300, { 0, 580, 0, 400 },
  525.     0,
  526.     256+32768, 0,
  527.     avg_init_palette_bzone,
  528.  
  529.     VIDEO_TYPE_VECTOR,
  530.     0,
  531.     avg_start_bzone,
  532.     avg_stop,
  533.     vector_vh_screenrefresh,
  534.  
  535.     /* sound hardware */
  536.     0,0,0,0,
  537.     {
  538.         {
  539.             SOUND_POKEY,
  540.             &bzone_pokey_interface
  541.         },
  542.         {
  543.             SOUND_CUSTOM,
  544.             &bzone_custom_interface
  545.         }
  546.     }
  547.  
  548. };
  549.  
  550.  
  551. static struct POKEYinterface redbaron_pokey_interface =
  552. {
  553.     1,    /* 1 chip */
  554.     1500000,    /* 1.5 MHz??? */
  555.     { 100 },
  556.     /* The 8 pot handlers */
  557.     { 0 },
  558.     { 0 },
  559.     { 0 },
  560.     { 0 },
  561.     { 0 },
  562.     { 0 },
  563.     { 0 },
  564.     { 0 },
  565.     /* The allpot handler */
  566.     { redbaron_joy_r },
  567. };
  568.  
  569.  
  570. static struct CustomSound_interface redbaron_custom_interface =
  571. {
  572.     redbaron_sh_start,
  573.     redbaron_sh_stop,
  574.     redbaron_sh_update
  575. };
  576.  
  577. static struct MachineDriver machine_driver_redbaron =
  578. {
  579.     /* basic machine hardware */
  580.     {
  581.         {
  582.             CPU_M6502,
  583.             1500000,    /* 1.5 Mhz */
  584.             redbaron_readmem,redbaron_writemem,0,0,
  585.             bzone_interrupt,4 /* 5.4ms */
  586.         }
  587.     },
  588.     45, 0,    /* frames per second, vblank duration (vector game, so no vblank) */
  589.     1,
  590.     0,
  591.  
  592.     /* video hardware */
  593.     400, 300, { 0, 520, 0, 400 },
  594.     0,
  595.     256, 0,
  596.     avg_init_palette_aqua,
  597.  
  598.     VIDEO_TYPE_VECTOR,
  599.     0,
  600.     avg_start_redbaron,
  601.     avg_stop,
  602.     vector_vh_screenrefresh,
  603.  
  604.     /* sound hardware */
  605.     0,0,0,0,
  606.     {
  607.         {
  608.             SOUND_POKEY,
  609.             &redbaron_pokey_interface
  610.         },
  611.         {
  612.             SOUND_CUSTOM,
  613.             &redbaron_custom_interface
  614.         }
  615.     },
  616.  
  617.     atari_vg_earom_handler
  618. };
  619.  
  620.  
  621. /***************************************************************************
  622.  
  623.   Game driver(s)
  624.  
  625. ***************************************************************************/
  626.  
  627. ROM_START( bzone )
  628.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  629.     ROM_LOAD( "036414.01",  0x5000, 0x0800, 0xefbc3fa0 )
  630.     ROM_LOAD( "036413.01",  0x5800, 0x0800, 0x5d9d9111 )
  631.     ROM_LOAD( "036412.01",  0x6000, 0x0800, 0xab55cbd2 )
  632.     ROM_LOAD( "036411.01",  0x6800, 0x0800, 0xad281297 )
  633.     ROM_LOAD( "036410.01",  0x7000, 0x0800, 0x0b7bfaa4 )
  634.     ROM_LOAD( "036409.01",  0x7800, 0x0800, 0x1e14e919 )
  635.     ROM_RELOAD(             0xf800, 0x0800 )    /* for reset/interrupt vectors */
  636.     /* Mathbox ROMs */
  637.     ROM_LOAD( "036422.01",  0x3000, 0x0800, 0x7414177b )
  638.     ROM_LOAD( "036421.01",  0x3800, 0x0800, 0x8ea8f939 )
  639. ROM_END
  640.  
  641. ROM_START( bzone2 )
  642.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  643.     ROM_LOAD( "036414a.01", 0x5000, 0x0800, 0x13de36d5 )
  644.     ROM_LOAD( "036413.01",  0x5800, 0x0800, 0x5d9d9111 )
  645.     ROM_LOAD( "036412.01",  0x6000, 0x0800, 0xab55cbd2 )
  646.     ROM_LOAD( "036411.01",  0x6800, 0x0800, 0xad281297 )
  647.     ROM_LOAD( "036410.01",  0x7000, 0x0800, 0x0b7bfaa4 )
  648.     ROM_LOAD( "036409.01",  0x7800, 0x0800, 0x1e14e919 )
  649.     ROM_RELOAD(             0xf800, 0x0800 )    /* for reset/interrupt vectors */
  650.     /* Mathbox ROMs */
  651.     ROM_LOAD( "036422.01",  0x3000, 0x0800, 0x7414177b )
  652.     ROM_LOAD( "036421.01",  0x3800, 0x0800, 0x8ea8f939 )
  653. ROM_END
  654.  
  655. ROM_START( redbaron )
  656.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  657.     ROM_LOAD( "037587.01",  0x4800, 0x0800, 0x60f23983 )
  658.     ROM_CONTINUE(           0x5800, 0x0800 )
  659.     ROM_LOAD( "037000.01e", 0x5000, 0x0800, 0x69bed808 )
  660.     ROM_LOAD( "036998.01e", 0x6000, 0x0800, 0xd1104dd7 )
  661.     ROM_LOAD( "036997.01e", 0x6800, 0x0800, 0x7434acb4 )
  662.     ROM_LOAD( "036996.01e", 0x7000, 0x0800, 0xc0e7589e )
  663.     ROM_LOAD( "036995.01e", 0x7800, 0x0800, 0xad81d1da )
  664.     ROM_RELOAD(             0xf800, 0x0800 )    /* for reset/interrupt vectors */
  665.     /* Mathbox ROMs */
  666.     ROM_LOAD( "037006.01e", 0x3000, 0x0800, 0x9fcffea0 )
  667.     ROM_LOAD( "037007.01e", 0x3800, 0x0800, 0x60250ede )
  668. ROM_END
  669.  
  670.  
  671.  
  672. GAME( 1980, bzone,    0,     bzone,    bzone,    0, ROT0, "Atari", "Battle Zone (set 1)" )
  673. GAME( 1980, bzone2,   bzone, bzone,    bzone,    0, ROT0, "Atari", "Battle Zone (set 2)" )
  674. GAME( 1980, redbaron, 0,     redbaron, redbaron, 0, ROT0, "Atari", "Red Baron" )
  675.